﻿namespace Sanjeet.FastCopy.FileCopyLogic.Design2
{
    public class AsyncOperation : IAsyncOperation<IAsyncable>
    {
        private IAsyncable operand;
        private AsyncWorker worker;

        #region IAsyncOperation<IAsyncable> Members

        public IAsyncable Operand
        {
            get { return operand; }
            set
            {
                operand = value;
                worker = new AsyncWorker(operand);
            }
        }

        public void Start()
        {
            worker.Start();
        }

        public void Stop()
        {
            worker.Stop();
        }

        public bool IsBusy
        {
            get { return worker.IsBusy; }
        }

        #endregion
    }
}